package net.com.sunkey.messagehandler;

import java.nio.ByteBuffer;

import net.com.sunkey.protobuf.CheckUserResponse.CheckUserResponseData;
import net.com.sunkey.protobuf.Protocol;
import net.com.sunkey.serverlogic.Server;

public class CheckUserResponseHandler {
	/* (non-Javadoc)
	 * @see com.sunkey.tdserver.messagehandler.MessageHandler#invoke(java.lang.Object, org.jboss.netty.channel.Channel)
	 */
	//@Override
	public static int invoke(Object data, Object channel) throws Exception {
		System.out.println("["+channel.hashCode()+"]["+Protocol.MessageHandler.CheckUserResponse_VALUE+"]CheckUserResponse");
		CheckUserResponseData.Builder builder=CheckUserResponseData.newBuilder();		
		builder.setIsUsed((boolean)data);
		CheckUserResponseData message=builder.build();
		Server.sendResponse(Protocol.MessageHandler.CheckUserResponse_VALUE, ByteBuffer.wrap(message.toByteArray()), channel);
		return Protocol.MessageHandler.CheckUserResponse_VALUE;
	}
}
